package com.tuo51.core.domain.pay;

import com.tuo51.foudation.model.Domain;
import lombok.Data;
import org.hibernate.annotations.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;

@Data
@Table(appliesTo = "org_wallet_flow",comment = "机构钱包流水信息")
@Entity(name="org_wallet_flow")
@EntityListeners(AuditingEntityListener.class)
public class OrgWalletFlow extends Domain {

    @Column(columnDefinition = "INT COMMENT '钱包id'")
    private Long walletId;

    @Column(columnDefinition = "INT COMMENT '类型：0.无变化 1. 进账 2. 出账'")
    private Integer type;

    @Column(columnDefinition = "INT COMMENT '来源类型：0. 无变化 1. 现金动账 2. 项目操作 3. 系统操作'")
    private Integer sourceType;

    @Column(columnDefinition = "varchar(2048) COMMENT '内容'")
    private String commentInfo;

    @Column(columnDefinition = "INT COMMENT '金额'")
    private Long money;

    public static OrgWalletFlow of(Long walletId, Long creatorId, String createdBy, Integer sourceType, Integer type, Long money, String commentInfo){
        OrgWalletFlow walletFlow = new OrgWalletFlow();

        walletFlow.setWalletId(walletId);

        walletFlow.setSourceType(sourceType);
        walletFlow.setType(type);

        walletFlow.setMoney(money);
        walletFlow.setCommentInfo(commentInfo);

        return walletFlow;
    }
}
